package com.jumper.study.admin.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jumper.study.admin.dto.req.EducationSearchReq;
import com.jumper.study.admin.dto.req.LessonOpenBatchReq;
import com.jumper.study.db.dto.StudentLessonDto;
import com.jumper.study.db.model.StudentLesson;

public interface StudentLessonService extends BaseService<StudentLesson> {
    //分页搜索学员开通课程
    IPage<StudentLessonDto> pageSearchWithAccountAndLesson(IPage<StudentLessonDto> page, EducationSearchReq req);

    //分页显示对应学员的课程学习时长
    IPage<StudentLessonDto> pageSearchWithLessonByAccountId(IPage<StudentLessonDto> page, Long accountId);

    //分页显示对应课程下学员学习情况
    IPage<StudentLessonDto> pageSearchWithAccountByLessonId(IPage<StudentLessonDto> page, Long lessonId);

    //开通课程
    boolean openLesson(StudentLesson entity);

    //批量开通课程
    void openLessonBatch(LessonOpenBatchReq req, Long adminId);

    //关闭课程
    boolean closeLesson(Long orderId, Long adminId);

    //关闭课程
    boolean closeLesson(StudentLesson entity);

    //根据用户id和课程id读取开通课程(未过期)
    StudentLesson getByAccountAndLessonId(Long accountId, Long lessonId);

    //根据用户id和课程id读取开通课程
    StudentLesson getByAccountAndLessonId(Long accountId, Long lessonId, boolean expired);

    //延长有效期
    boolean plusExpireTimeById(StudentLesson entity);
}
